<?php
declare (strict_types = 1);

namespace app\admin\controller;
use app\admin\model\Order;
use think\facade\Db;
use think\facade\View;
use think\facade\Request;

Class orderlist
{
    public function order_list()
    {

        $keywords =Request::get('keywords');
        $cid=Request::get('cid');
        $smin = Request::get('smin');
        $smax = Request::get('smax');
        $min1 = Request::get('min');
        $max1 = Request::get('max');
        $data=[
            'cid'       => $cid,
            'keywords'  => $keywords,
            'smin'      => $smin,
            'smax'      => $smax,
            'min'       => $min1,
            'max'       => $max1,
        ];
        $rt1=\app\admin\model\Order::Order($data,input('get.'));


        $rt=\app\admin\model\Order::test();
        View::assign('arr',$rt);
        View::assign('arr1',$rt1);
        View::assign('cid',$cid);
        View::assign('min',$smin);
        View::assign('min1',$min1);
        View::assign('max',$smax);
        View::assign('max1',$max1);
        View::assign('keyword',$keywords);
        return View::fetch();


//        $add_time1=Request::get('add_time1','');
//        $add_time2=Request::get('add_time2','');
//        $order_amount1=Request::get('order_amount1','');
//        $order_amount2=Request::get('order_amount2','');
//        $order_status=Request::get('order_status','','trim,htmlspecialchars,strip_tags');
//        $data=[
//            'add_time1'=>$add_time1,
//            'add_time2'=>$add_time2,
//            'order_amount1'=>$order_amount1,
//            'order_amount2'=>$order_amount2,
//            'order_status'=>$order_status,
//        ];
//        $elist= \app\admin\model\Order::Order($data,input('get.'));
//        $b= \app\admin\model\Order::test();
//        View::assign('elist',$elist);
//        View::assign('b',$b);
//        View::assign('add_time1',$add_time1);
//        View::assign('add_time2',$add_time2);
//        View::assign('order_amount1',$order_amount1);
//        View::assign('order_amount2',$order_amount2);
//        return View::fetch();
//        $a=Db::table('ecm_order')
//            ->alias('o')
//            ->field('o.*')
//            ->field('order_status')
//            ->field('p.payment_name')
//            ->join(['ecm_order_status'=>'s'],'o.status=s.status_id','left')
//            ->join(['ecm_payment'=>'p'],'o.payment_id=p.payment_id')  ;


//        $b=Db::table('ecm_order_status')->field(true)->select();
//        if ($add_time1!='' and $add_time2!=''){
//            $a ->whereBetweenTime("add_time","$add_time1,$add_time2");
//        }
//
//            if($order_status!=''){
//                foreach ($order_status as $v){
//                $a->whereOr("status=$v");
//            }
//        }
//        if ($order_amount1!='' and $order_amount2!=''){
//            $a ->whereBetween("order_amount","$order_amount1,$order_amount2");
//        }else if($order_amount1='' and $order_amount2!=''){
//            $a ->where("order_amount","$order_amount2");
//        }else if($order_amount1!='' and $order_amount2='')
//        {
//            $a ->where("order_amount","$order_amount1");
//        }
//            $elist= $a->paginate([
//                'list_tows'=>10,
//                'query' =>input('get.'),
//                'var_page'=>'p',
//            ]);
//        $page = $elist->render();
//        View::assign('page',$page);

    }
}